package org.jeecg.modules.api.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.assets.entity.AssetsInfo;
import org.jeecg.modules.assets.entity.AssetsItem;
import org.jeecg.modules.assets.service.IAssetsItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@Api(tags = "资产明细")
@RestController
@RequestMapping("api/assets/assetsItem")

public class AssetsApiController {

    @Autowired
    private IAssetsItemService assetsItemService;

    /**
     * 通过id查询
     *
     * @return
     */
    @AutoLog(value = "资产明细-通过code查询")
    @ApiOperation(value = "资产明细-通过code查询", notes = "资产明细-通过code查询")
    @GetMapping(value = "/queryByCode")
    public Result<?> queryById(@RequestParam(name = "code", required = true) String code) {
        log.info("通过code查询资产明细");


        AssetsItem assetsItem = assetsItemService.queryByCode(  code.substring(code.length()-6));
        return Result.OK(assetsItem);
    }



}
